home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: user1.mnsinc.com!huang
  2. From: huang@mnsinc.com (Szu-Wen Huang)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: fast find algorithm
  5. Date: 7 Apr 1996 22:44:44 GMT
  6. Organization: Monumental Network Systems
  7. Message-ID: <4k9ggs$4ov@news1.mnsinc.com>
  8. References: <Dp8wE6.8DG@cix.compulink.co.uk> <PdvZxMlyZE9U088yn@ime.usp.br>
  9. NNTP-Posting-Host: user1.mnsinc.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Rogerio Brito (rbrito@ime.usp.br) wrote:
  13. : huang@mnsinc.com (Szu-Wen Huang) wrote:
  14. : >Falstaff (falstaff@xs4all.nl) wrote:
  15. : >...
  16. : >: Hashing is slightly slower than straight table lookup and can't be
  17. : >: used when you want to delete elements from your table.
  18. : >...
  19.  
  20. : >Hashing can't be used when you want to delete elements?  Please explain.
  21.  
  22. :         I think he is refering to elimination of the item of some
  23. :         table.   In  such  case,  you  should  change  your  hash
  24. :         function.  But if you don't have memory problems, you can
  25. :         simply ignore the  location  after  it  is "deleted".  Or
  26. :         depending on the implementation, you can simply unlink it
  27. :         from your linked list (if it is the case, of course).
  28.  
  29. Hash tables need to have null entries so the search will know that
  30. the item doesn't exist.  I don't see why it is difficult to find
  31. the item to be deleted and overwrite it with the null entry.  As
  32. you said, it'll work on linked lists, but it will work also on array
  33. implementations.
  34.